package examlab.gc;

class A {

    static int i = 0;

    A a1;
    A a2;

    @Override
    public void finalize() {
        i++;
    }

    public static void main(String args[]) {
        A s1 = new A();
        s1.a1 = new A();
        s1.a2 = s1;
        s1.a1.a2 = new A();
        s1.a1.a2.a2 = new A();
        s1.a1.a2.a2.a1 = s1.a1;
        s1.a2.a1.a2 = null;
        System.gc();
        try {
            Thread.currentThread();
            Thread.sleep(1000);
        } catch (InterruptedException e) {

            e.printStackTrace();
        }

        System.out.println("-" + i);
        System.out.println(20 % 3);
    }

}